package cz.muni.fi.pa165.ddtroopsejb.daoclasses;

import cz.muni.fi.pa165.ddtroopsejb.daointerfaces.SkillDAO;
import cz.muni.fi.pa165.ddtroopsejb.entities.Skill;
//import org.springframework.stereotype.Repository;

/**
 * Class SkillDAOImpl serves as a Data Access Object class for entity Skill.
 * SkillDAOImpl class extends generic abstract class BaseDAOImpl. See SkillDAO
 * for set of supported methods.
 *
 * @author Jaromír Svoboda
 */
//@Repository(value = "skillDAO")
public class SkillDAOImpl extends BaseDAOImpl<Skill> implements SkillDAO
{
    @Override
    protected boolean isValid(Skill s){
        return s.getDescription() != null &&
               s.getMinXP() != null &&
               s.getName() != null &&
               s.getProfession() != null &&
               !s.getDescription().isEmpty() &&
               !s.getName().isEmpty() &&
               !s.getProfession().isEmpty();
    }

    @Override
    protected boolean isIn(Skill object) {
        return getById(object.getId()) != null;
    }
}
